package com.sykj.qianxuezhan.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.sykj.qianxuezhan.bean.BusinessOrder;
import com.sykj.qianxuezhan.mapper.BagProjectMapper;
import com.sykj.qianxuezhan.server.BagProjectService;
import com.sykj.qianxuezhan.server.BusinessOrderService;
import com.sykj.qianxuezhan.server.ShopService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Author QianXuezhan
 * @Date 2020/8/4 10:09
 * @Description: TODO  businessOrder控制层
 */

@RestController
@CrossOrigin
@RequestMapping("/businessOrder")
public class BusinessOrderController {
    @Autowired
    private BusinessOrderService businessOrderService;
    @Autowired
    private ShopService shopService;

    /**
    * @Description:  查询所有综合查询
    **/
    @RequestMapping(value="/queryAll",method = RequestMethod.GET)
    public List<BusinessOrder>  queryAll(String  orderId, String  customUserId, String username , String  orderStatus, String  payWay, String  shopId, String  username1, String  username2, String  orderContent, String  orderSource){
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");//注意月份是MM
        BusinessOrder businessOrder=new BusinessOrder();
            businessOrder.setOrderId(orderId);
            businessOrder.setCustomUserId(customUserId);
            businessOrder.setUsername(username);
            businessOrder.setOrderStatus(orderStatus);
            businessOrder.setPayWay(payWay);
            businessOrder.setShopId(shopId);
            businessOrder.setUsername1(username1);
            businessOrder.setUsername2(username2);
            businessOrder.setOrderContent(orderContent);
            businessOrder.setOrderSource(orderSource);
        return   businessOrderService.queryAll(businessOrder);
    }

    /**
    * @Description:  查询所有店铺信息
    **/
    @RequestMapping(value="/queryShopAll",method = RequestMethod.GET)
    public Map queryShopAll(){

        QueryWrapper queryWrapper=new QueryWrapper();
        queryWrapper.select("shop_id","shop_name");
        Map  map=new HashMap();
        map.put("shop",shopService.list(queryWrapper));
        return  map;
    }


}
